<template>
  <ty-plm-dialog
    v-model="vModel"
    @open="openDialog"
    :options="{
      title: $t('basic.title.selectObject'),
      width: 1400,
      customClass: isAdvancedSearch ? 'select-object-dialog' : 'select-object-dialog-custom',
      appendToBody: true
    }"
  >

    <select-object-content
      :field="field"
      :customUrlParams="customUrlParams"
      ref="selectObjectContentRef"
      @confirm="sendSelectData"
    ></select-object-content>
    <template #footer>
      <ty-plm-dialog-footer class="changeOrderViewBaseDialogFooter">
        <template v-for="item in btnOptions" :key="item.title">
          <ty-plm-button v-if="!item.hide" :options="item" @click="operate(item.key)" />
        </template>
      </ty-plm-dialog-footer>
    </template>
  </ty-plm-dialog>
</template>

<script setup>

import basic from '@common/basic'
// const  selectObjectContent = basic.getExportResource('src/basic/components/ty-select-object/select-object-content.vue').default ;
import selectObjectContent from './select-object-content-rato.vue'
defineOptions({
  name: 'SelectObjectDialog',
  inheritAttrs: false
});
// ✅ 步骤 1：获取模块

const props =defineProps(basic.getExportResource('src/basic/components/ty-select-object/composables/ty-select-object-dialog.js').createProps())

const emit = defineEmits(basic.getExportResource('src/basic/components/ty-select-object/composables/ty-select-object-dialog.js').createEmits());

// ✅ 步骤 4：只调用一次组合函数
const {
  vModel,
  btnOptions,
  operate,
  openDialog,
  selectObjectContentRef,
  sendSelectData,
  isAdvancedSearch
} = (basic.getExportResource('src/basic/components/ty-select-object/composables/ty-select-object-dialog.js').useOverride || basic.getExportResource('src/basic/components/ty-select-object/composables/ty-select-object-dialog.js').useSelectObjectDialog)(props, emit);

</script>
<style lang="scss">
.select-object-popover.el-popover.el-popper {
  padding: 0;
}
.select-object {
  min-height: 30px;
  width: 100%;
  .tox.tox-tinymce {
    box-sizing: content-box;
  }
}
.select-object-dialog-custom {
  height: 605px !important;
}
.select-object-dialog-custom,
.select-object-dialog {
  height: 645px;
  margin-top: 50px;
  .el-dialog__body {
    height: calc(100% - 110px) !important;
  }
  .top-search {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-bottom: 12px;
    .search-input {
      width: 160px;
      margin-right: 8px;
    }
  }
  .select-object-pagination {
    margin-top: 12px;
    .ty-base-pagination--select {
      overflow: hidden;
    }
  }
}
</style>
